package com.baturu.vin.benz.dto;

import com.baturu.vin.base.dto.BasePartsImageInfoDTO;
import com.google.common.collect.Sets;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.util.Set;

/**
 * 奔驰配件编码获取图片名称DTO
 *
 * @author 蒋鑫磊
 * @Time 2016/11/28.
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class BenzImageDTO extends BasePartsImageInfoDTO{

    private String catnum;

    private String subgrp;

    private String seqno;

    private String imgtype;

    private String archived;

    private String restimg;

    private String groupnum;

    private String callout;

    /**
     * 完整图片路径
     */
    private String imageUrl;

    @Override
    public String getImageName() {
        return this.getImageCode();
    }

    @Override
    public String getImageCode() {
        return imgtype+groupnum+subgrp+seqno+restimg;
    }

    public String getCatalog() {
        return imgtype+groupnum+subgrp;
    }

    public Set<String> getCallouts() {
        return Sets.newHashSet(StringUtils.split(callout, "  "));
    }

}
